<style type="text/css">
    .layui-table-body{overflow-x:auto;}
    .layui-table-cell{font-size:12px;}
</style>
<div class="layui-form hisi-search">
    <form action="{:url()}" method="get" id="hisi-table-search">
        <div class="layui-form-item">
            <label class="layui-form-label">会员</label>
            <div class="layui-input-inline">
                <select name="user_id" class="layui-input field-user_id" lay-verify="required" lay-search="">
                  <option value="">直接选择或搜索选择</option>
                  {volist name="users" id='vo'}
                  <option value="{$vo.id}">{$vo.nick}</option>
                  {/volist}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">开始时间</label>
          <div class="layui-input-inline">
            <!-- <input type="text" class="layui-input field-start_end" id="test6" name="start_end" placeholder=" - "> -->
            <input type="text" class="layui-input field-start" id="start" name="start" placeholder="yyyy-MM-dd">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">结束时间</label>
          <div class="layui-input-inline">
            <input type="text" class="layui-input field-end" id="end" name="end" placeholder="yyyy-MM-dd">
          </div>
        </div>
        <input type="hidden" name="state" value="1">
        <div class="layui-form-item hisi-search-btn">

            <div class="layui-input-inline">
                <button type="submit" class="layui-btn layui-btn-normal layui-icon layui-icon-search">执行</button>
            </div>
        </div>
    </form>
</div>
<table id="dataTable"></table>

<script type="text/html" id="statusTpl">
    <input type="checkbox" name="status" value="{{ d.status }}" lay-skin="switch" lay-filter="switchStatus" lay-text="正常|关闭" {{ d.status == 1 ? 'checked' : '' }} data-href="{:url('status')}?id={{ d.id }}">
</script>
<script type="text/html" title="操作按钮模板" id="buttonTpl">
    <a href="{:url('kaidan')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-warm">开单</a>
    <a href="{:url('edit')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-normal hisi-iframe-pop"  hisi-data="{width: '800px', height: '600px', title: '修改'}">修改</a>
    <a href="{:url('del')}?id={{ d.id }}" class="layui-btn layui-btn-xs layui-btn-danger j-tr-del">删除</a>
</script>
{include file="system@block/layui" /}
<script id="toolbar" type="text/html">
    <a href="{:url('add')}" class="layui-btn layui-btn-normal layui-btn-sm hisi-iframe-pop" hisi-data="{width: '800px', height: '600px', title: '添加'}">&nbsp;添加</a>
</script>
<script type="text/javascript">
    layui.use(['table','laydate'], function() {
        var table = layui.table;
        var laydate = layui.laydate;

        //日期范围
    laydate.render({
      elem: '#start'
    });
    laydate.render({
      elem: '#end'
    });
        table.render({
            elem: '#dataTable'
            ,url: '{:url()}?state={$state}' //数据接口
            ,page: true //开启分页
            ,skin: 'row'
            ,even: true
            ,limit: 20
            ,text: {
                none : '暂无相关数据'
            }
            ,toolbar: '#toolbar'
            ,defaultToolbar: ['filter']
            ,cols: [[ //表头
                {type:'checkbox'}
                ,{field: 'shop_id', title: '门店名称',templet:function(d){
                    return d.has_shop.name
                }}
                ,{field: 'user_id', title: '会员',templet:function(d){
                    return d.has_user.nick
                }}
                ,{field: 'room_id', title: '房间',templet:function(d){
                    return d.has_room.name
                }}
                ,{field: 'adviser', title: '预约顾问'}
                ,{field: 'technician_ids', title: '预约美容师',templet:function(d){
                    return d.technician;
                }}
                ,{field: 'projects', title: '预约项目'}
                ,{field: 'appointment_time', title: '预约时间'}
                ,{field: 'cashier', title: '收银'}
                ,{field: 'remarks', title: '备注'}

                ,{title: '操作', width: 200, templet: '#buttonTpl'}
            ]]
            ,done: function(){
                if (typeof(layui.global.addTableTool) !== 'undefined') {
                    layui.global.addTableTool();
                }
            }
        });
    });
</script>
